package com.spider.strategy;

import com.spider.page.JsonPage;
import com.spider.page.ResultPage;
import com.spider.pool.UriQueueScheduler;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpRequestBase;

/**
 * @author β世界
 * Created on 10:23
 * @Description Json类型的响应处理策略
 */
public class JsonResponseStrategy implements ResponseStrategy{
    @Override
    public String[] getHandlerContentType() {
        return new String[]{"application/json"};
    }

    /**
     * 创建一个html的处理类
     * @author β世界 on 10:34 2021/5/10
     * @param response: 响应内容
     * @param httpRequestBase: 请求实体
     * @return com.spider.page.ResultPage
     **/
    @Override
    public ResultPage create(CloseableHttpResponse response, HttpRequestBase httpRequestBase, UriQueueScheduler uriQueueScheduler) {
        return new JsonPage(response, httpRequestBase, uriQueueScheduler);
    }
}
